package com.htgd.gardenexpo.service.impl;

import com.htgd.gardenexpo.entity.GeConAnnouncementUpload;
import com.htgd.gardenexpo.dao.GeConAnnouncementUploadDao;
import com.htgd.gardenexpo.service.GeConAnnouncementUploadService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (GeConAnnouncementUpload)表服务实现类
 *
 * @author makejava
 * @since 2021-06-09 15:43:53
 */
@Service("geConAnnouncementUploadService")
public class GeConAnnouncementUploadServiceImpl implements GeConAnnouncementUploadService {
    @Resource
    private GeConAnnouncementUploadDao geConAnnouncementUploadDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public GeConAnnouncementUpload queryById(Integer id) {
        return this.geConAnnouncementUploadDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<GeConAnnouncementUpload> queryAllByLimit(int offset, int limit) {
        return this.geConAnnouncementUploadDao.queryAllByLimit(offset, limit);
    }
    @Override
    public List<GeConAnnouncementUpload> queryByAnnouncementId(int id) {
        return this.geConAnnouncementUploadDao.queryByAnnouncementId(id);
    }

    /**
     * 新增数据
     *
     * @param geConAnnouncementUpload 实例对象
     * @return 实例对象
     */
    @Override
    public GeConAnnouncementUpload insert(GeConAnnouncementUpload geConAnnouncementUpload) {
        this.geConAnnouncementUploadDao.insert(geConAnnouncementUpload);
        return geConAnnouncementUpload;
    }

    /**
     * 修改数据
     *
     * @param geConAnnouncementUpload 实例对象
     * @return 实例对象
     */
    @Override
    public GeConAnnouncementUpload update(GeConAnnouncementUpload geConAnnouncementUpload) {
        this.geConAnnouncementUploadDao.update(geConAnnouncementUpload);
        return this.queryById(geConAnnouncementUpload.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.geConAnnouncementUploadDao.deleteById(id) > 0;
    }

    @Override
    public boolean deleteByAnnouncementId(Integer id) {
        return this.geConAnnouncementUploadDao.deleteByAnnouncementId(id) > 0;
    }
    @Override
    public boolean deleteByIds(String[] id,int aid) {
        return this.geConAnnouncementUploadDao.deleteByIds(id,aid) > 0;
    }
}
